home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1992-08-29 | 8.8 KB | [ TEXT/ALFA]
open in: MacOS 8.1
extracted
|
Win98
extracted
|
DOS
extracted
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary ).
You can browse this item here: Regular Expressions
Confidence Program Detection Match Type Support
10%
dexvert
MacBinary (archive/macBinary)
fallback
Supported
1%
dexvert
Text File (text/txt)
fallback
Supported
100%
file
MacBinary II, inited, Sat Aug 29 12:43:40 1992, modified Sat Aug 29 12:43:40 1992, creator Alpha editor, type ASCII, 8345 bytes "Regular Expressions" , at 0x2119 382 bytes resource
default (weak)
99%
file
data
default
74%
TrID
Macintosh plain text (MacBinary)
default
25%
TrID
MacBinary 2
default (weak)
100%
siegfried
fmt/1762 MacBinary (II)
default
100%
lsar
MacBinary
default
id metadata key value macFileType [ TEXT] macFileCreator [ ALFA]
hex view +--------+-------------------------+-------------------------+--------+--------+ |00000000| 00 13 52 65 67 75 6c 61 | 72 20 45 78 70 72 65 73 |..Regula|r Expres| |00000010| 73 69 6f 6e 73 00 00 00 | 00 00 00 00 00 00 00 00 |sions...|........| |00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00000040| 00 54 45 58 54 41 4c 46 | 41 01 00 00 00 00 00 00 |.TEXTALF|A.......| |00000050| 00 00 00 00 00 20 99 00 | 00 01 7e a6 c5 59 bc a6 |..... ..|..~..Y..| |00000060| c5 59 bc 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.Y......|........| |00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 bc b7 00 00 |........|........| |00000080| 4e 4f 54 45 3a 20 09 54 | 68 65 20 66 6f 6c 6c 6f |NOTE: .T|he follo| |00000090| 77 69 6e 67 20 69 73 20 | 74 68 65 20 6d 61 6e 75 |wing is |the manu| |000000a0| 61 6c 20 70 61 67 65 20 | 73 75 70 70 6c 69 65 64 |al page |supplied| |000000b0| 20 77 69 74 68 20 74 68 | 65 20 72 65 67 75 6c 61 | with th|e regula| |000000c0| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 0d 09 09 72 |r expres|sion...r| |000000d0| 6f 75 74 69 6e 65 73 20 | 75 73 65 64 20 62 6f 74 |outines |used bot| |000000e0| 68 20 69 6e 20 41 6c 70 | 68 61 20 61 6e 64 20 54 |h in Alp|ha and T| |000000f0| 63 6c 2e 20 2d 20 70 65 | 74 65 2e 0d 0d 0d 0d 20 |cl. - pe|te..... | |00000100| 20 20 20 20 52 45 47 45 | 58 50 28 33 29 20 20 20 | REGE|XP(3) | |00000110| 20 20 20 20 20 20 20 20 | 20 20 55 4e 49 58 20 53 | | UNIX S| |00000120| 79 73 74 65 6d 20 56 20 | 28 6c 6f 63 61 6c 29 20 |ystem V |(local) | |00000130| 20 20 20 20 20 20 20 20 | 20 20 20 20 52 45 47 45 | | REGE| |00000140| 58 50 28 33 29 0d 0d 0d | 20 20 20 20 20 4e 41 4d |XP(3)...| NAM| |00000150| 45 0d 20 20 20 20 20 20 | 20 20 20 20 72 65 67 63 |E. | regc| |00000160| 6f 6d 70 2c 20 72 65 67 | 65 78 65 63 2c 20 72 65 |omp, reg|exec, re| |00000170| 67 73 75 62 2c 20 72 65 | 67 65 72 72 6f 72 20 2d |gsub, re|gerror -| |00000180| 20 72 65 67 75 6c 61 72 | 20 65 78 70 72 65 73 73 | regular| express| |00000190| 69 6f 6e 0d 20 20 20 20 | 20 20 20 20 20 20 68 61 |ion. | ha| |000001a0| 6e 64 6c 65 72 0d 0d 20 | 20 20 20 20 53 59 4e 4f |ndler.. | SYNO| |000001b0| 50 53 49 53 0d 20 20 20 | 20 20 20 20 20 20 20 23 |PSIS. | #| |000001c0| 69 6e 63 6c 75 64 65 20 | 3c 72 65 67 65 78 70 2e |include |<regexp.| |000001d0| 68 3e 0d 0d 20 20 20 20 | 20 20 20 20 20 20 72 65 |h>.. | re| |000001e0| 67 65 78 70 20 2a 72 65 | 67 63 6f 6d 70 28 65 78 |gexp *re|gcomp(ex| |000001f0| 70 29 0d 20 20 20 20 20 | 20 20 20 20 20 63 68 61 |p). | cha| |00000200| 72 20 2a 65 78 70 3b 0d | 0d 20 20 20 20 20 20 20 |r *exp;.|. | |00000210| 20 20 20 69 6e 74 20 72 | 65 67 65 78 65 63 28 70 | int r|egexec(p| |00000220| 72 6f 67 2c 20 73 74 72 | 69 6e 67 29 0d 20 20 20 |rog, str|ing). | |00000230| 20 20 20 20 20 20 20 72 | 65 67 65 78 70 20 2a 70 | r|egexp *p| |00000240| 72 6f 67 3b 0d 20 20 20 | 20 20 20 20 20 20 20 63 |rog;. | c| |00000250| 68 61 72 20 2a 73 74 72 | 69 6e 67 3b 0d 0d 20 20 |har *str|ing;.. | |00000260| 20 20 20 20 20 20 20 20 | 72 65 67 73 75 62 28 70 | |regsub(p| |00000270| 72 6f 67 2c 20 73 6f 75 | 72 63 65 2c 20 64 65 73 |rog, sou|rce, des| |00000280| 74 29 0d 20 20 20 20 20 | 20 20 20 20 20 72 65 67 |t). | reg| |00000290| 65 78 70 20 2a 70 72 6f | 67 3b 0d 20 20 20 20 20 |exp *pro|g;. | |000002a0| 20 20 20 20 20 63 68 61 | 72 20 2a 73 6f 75 72 63 | cha|r *sourc| |000002b0| 65 3b 0d 20 20 20 20 20 | 20 20 20 20 20 63 68 61 |e;. | cha| |000002c0| 72 20 2a 64 65 73 74 3b | 0d 0d 20 20 20 20 20 20 |r *dest;|.. | |000002d0| 20 20 20 20 72 65 67 65 | 72 72 6f 72 28 6d 73 67 | rege|rror(msg| |000002e0| 29 0d 20 20 20 20 20 20 | 20 20 20 20 63 68 61 72 |). | char| |000002f0| 20 2a 6d 73 67 3b 0d 0d | 20 20 20 20 20 44 45 53 | *msg;..| DES| |00000300| 43 52 49 50 54 49 4f 4e | 0d 20 20 20 20 20 20 20 |CRIPTION|. | |00000310| 20 20 20 54 68 65 73 65 | 20 66 75 6e 63 74 69 6f | These| functio| |00000320| 6e 73 20 69 6d 70 6c 65 | 6d 65 6e 74 20 65 67 72 |ns imple|ment egr| |00000330| 65 70 28 31 29 2d 73 74 | 79 6c 65 20 72 65 67 75 |ep(1)-st|yle regu| |00000340| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 73 0d |lar expr|essions.| |00000350| 20 20 20 20 20 20 20 20 | 20 20 61 6e 64 20 73 75 | | and su| |00000360| 70 70 6f 72 74 69 6e 67 | 20 66 61 63 69 6c 69 74 |pporting| facilit| |00000370| 69 65 73 2e 0d 0d 20 20 | 20 20 20 20 20 20 20 20 |ies... | | |00000380| 52 65 67 63 6f 6d 70 20 | 63 6f 6d 70 69 6c 65 73 |Regcomp |compiles| |00000390| 20 61 20 72 65 67 75 6c | 61 72 20 65 78 70 72 65 | a regul|ar expre| |000003a0| 73 73 69 6f 6e 20 69 6e | 74 6f 20 61 20 73 74 72 |ssion in|to a str| |000003b0| 75 63 74 75 72 65 20 6f | 66 0d 20 20 20 20 20 20 |ucture o|f. | |000003c0| 20 20 20 20 74 79 70 65 | 20 72 65 67 65 78 70 2c | type| regexp,| |000003d0| 20 61 6e 64 20 72 65 74 | 75 72 6e 73 20 61 20 70 | and ret|urns a p| |000003e0| 6f 69 6e 74 65 72 20 74 | 6f 20 69 74 2e 20 20 54 |ointer t|o it. T| |000003f0| 68 65 20 73 70 61 63 65 | 20 68 61 73 0d 20 20 20 |he space| has. | |00000400| 20 20 20 20 20 20 20 62 | 65 65 6e 20 61 6c 6c 6f | b|een allo| |00000410| 63 61 74 65 64 20 75 73 | 69 6e 67 20 6d 61 6c 6c |cated us|ing mall| |00000420| 6f 63 28 33 29 20 61 6e | 64 20 6d 61 79 20 62 65 |oc(3) an|d may be| |00000430| 20 72 65 6c 65 61 73 65 | 64 20 62 79 20 66 72 65 | release|d by fre| |00000440| 65 2e 0d 0d 20 20 20 20 | 20 20 20 20 20 20 52 65 |e... | Re| |00000450| 67 65 78 65 63 20 6d 61 | 74 63 68 65 73 20 61 20 |gexec ma|tches a | |00000460| 4e 55 4c 2d 74 65 72 6d | 69 6e 61 74 65 64 20 73 |NUL-term|inated s| |00000470| 74 72 69 6e 67 20 61 67 | 61 69 6e 73 74 20 74 68 |tring ag|ainst th| |00000480| 65 20 63 6f 6d 70 69 6c | 65 64 0d 20 20 20 20 20 |e compil|ed. | |00000490| 20 20 20 20 20 72 65 67 | 75 6c 61 72 20 65 78 70 | reg|ular exp| |000004a0| 72 65 73 73 69 6f 6e 20 | 69 6e 20 70 72 6f 67 2e |ression |in prog.| |000004b0| 20 20 49 74 20 72 65 74 | 75 72 6e 73 20 31 20 66 | It ret|urns 1 f| |000004c0| 6f 72 20 73 75 63 63 65 | 73 73 20 61 6e 64 20 30 |or succe|ss and 0| |000004d0| 0d 20 20 20 20 20 20 20 | 20 20 20 66 6f 72 20 66 |. | for f| |000004e0| 61 69 6c 75 72 65 2c 20 | 61 6e 64 20 61 64 6a 75 |ailure, |and adju| |000004f0| 73 74 73 20 74 68 65 20 | 63 6f 6e 74 65 6e 74 73 |sts the |contents| |00000500| 20 6f 66 20 70 72 6f 67 | 27 73 20 73 74 61 72 74 | of prog|'s start| |00000510| 70 20 61 6e 64 0d 20 20 | 20 20 20 20 20 20 20 20 |p and. | | |00000520| 65 6e 64 70 20 28 73 65 | 65 20 62 65 6c 6f 77 29 |endp (se|e below)| |00000530| 20 61 63 63 6f 72 64 69 | 6e 67 6c 79 2e 0d 0d 20 | accordi|ngly... | |00000540| 20 20 20 20 20 20 20 20 | 20 54 68 65 20 6d 65 6d | | The mem| |00000550| 62 65 72 73 20 6f 66 20 | 61 20 72 65 67 65 78 70 |bers of |a regexp| |00000560| 20 73 74 72 75 63 74 75 | 72 65 20 69 6e 63 6c 75 | structu|re inclu| |00000570| 64 65 20 61 74 20 6c 65 | 61 73 74 20 74 68 65 0d |de at le|ast the.| |00000580| 20 20 20 20 20 20 20 20 | 20 20 66 6f 6c 6c 6f 77 | | follow| |00000590| 69 6e 67 20 28 6e 6f 74 | 20 6e 65 63 65 73 73 61 |ing (not| necessa| |000005a0| 72 69 6c 79 20 69 6e 20 | 6f 72 64 65 72 29 3a 0d |rily in |order):.| |000005b0| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | | |000005c0| 63 68 61 72 20 2a 73 74 | 61 72 74 70 5b 4e 53 55 |char *st|artp[NSU| |000005d0| 42 45 58 50 5d 3b 0d 20 | 20 20 20 20 20 20 20 20 |BEXP];. | | |000005e0| 20 20 20 20 20 20 63 68 | 61 72 20 2a 65 6e 64 70 | ch|ar *endp| |000005f0| 5b 4e 53 55 42 45 58 50 | 5d 3b 0d 0d 20 20 20 20 |[NSUBEXP|];.. | |00000600| 20 20 20 20 20 20 77 68 | 65 72 65 20 4e 53 55 42 | wh|ere NSUB| |00000610| 45 58 50 20 69 73 20 64 | 65 66 69 6e 65 64 20 28 |EXP is d|efined (| |00000620| 61 73 20 31 30 29 20 69 | 6e 20 74 68 65 20 68 65 |as 10) i|n the he| |00000630| 61 64 65 72 20 66 69 6c | 65 2e 20 20 4f 6e 63 65 |ader fil|e. Once| |00000640| 20 61 0d 20 20 20 20 20 | 20 20 20 20 20 73 75 63 | a. | suc| |00000650| 63 65 73 73 66 75 6c 20 | 72 65 67 65 78 65 63 20 |cessful |regexec | |00000660| 68 61 73 20 62 65 65 6e | 20 64 6f 6e 65 20 75 73 |has been| done us| |00000670| 69 6e 67 20 74 68 65 20 | 72 65 67 65 78 70 2c 20 |ing the |regexp, | |00000680| 65 61 63 68 0d 20 20 20 | 20 20 20 20 20 20 20 73 |each. | s| |00000690| 74 61 72 74 70 2d 65 6e | 64 70 20 70 61 69 72 20 |tartp-en|dp pair | |000006a0| 64 65 73 63 72 69 62 65 | 73 20 6f 6e 65 20 73 75 |describe|s one su| |000006b0| 62 73 74 72 69 6e 67 20 | 77 69 74 68 69 6e 20 74 |bstring |within t| |000006c0| 68 65 20 73 74 72 69 6e | 67 2c 0d 20 20 20 20 20 |he strin|g,. | |000006d0| 20 20 20 20 20 77 69 74 | 68 20 74 68 65 20 73 74 | wit|h the st| |000006e0| 61 72 74 70 20 70 6f 69 | 6e 74 69 6e 67 20 74 6f |artp poi|nting to| |000006f0| 20 74 68 65 20 66 69 72 | 73 74 20 63 68 61 72 61 | the fir|st chara| |00000700| 63 74 65 72 20 6f 66 20 | 74 68 65 0d 20 20 20 20 |cter of |the. | |00000710| 20 20 20 20 20 20 73 75 | 62 73 74 72 69 6e 67 20 | su|bstring | |00000720| 61 6e 64 20 74 68 65 20 | 65 6e 64 70 20 70 6f 69 |and the |endp poi| |00000730| 6e 74 69 6e 67 20 74 6f | 20 74 68 65 20 66 69 72 |nting to| the fir| |00000740| 73 74 20 63 68 61 72 61 | 63 74 65 72 0d 20 20 20 |st chara|cter. | |00000750| 20 20 20 20 20 20 20 66 | 6f 6c 6c 6f 77 69 6e 67 | f|ollowing| |00000760| 20 74 68 65 20 73 75 62 | 73 74 72 69 6e 67 2e 20 | the sub|string. | |00000770| 20 54 68 65 20 30 74 68 | 20 73 75 62 73 74 72 69 | The 0th| substri| |00000780| 6e 67 20 69 73 20 74 68 | 65 20 73 75 62 73 74 72 |ng is th|e substr| |00000790| 69 6e 67 0d 20 20 20 20 | 20 20 20 20 20 20 6f 66 |ing. | of| |000007a0| 20 73 74 72 69 6e 67 20 | 74 68 61 74 20 6d 61 74 | string |that mat| |000007b0| 63 68 65 64 20 74 68 65 | 20 77 68 6f 6c 65 20 72 |ched the| whole r| |000007c0| 65 67 75 6c 61 72 20 65 | 78 70 72 65 73 73 69 6f |egular e|xpressio| |000007d0| 6e 2e 20 20 54 68 65 0d | 20 20 20 20 20 20 20 20 |n. The.| | |000007e0| 20 20 6f 74 68 65 72 73 | 20 61 72 65 20 74 68 6f | others| are tho| |000007f0| 73 65 20 73 75 62 73 74 | 72 69 6e 67 73 20 74 68 |se subst|rings th| |00000800| 61 74 20 6d 61 74 63 68 | 65 64 20 70 61 72 65 6e |at match|ed paren| |00000810| 74 68 65 73 69 7a 65 64 | 0d 20 20 20 20 20 20 20 |thesized|. | |00000820| 20 20 20 65 78 70 72 65 | 73 73 69 6f 6e 73 20 77 | expre|ssions w| |00000830| 69 74 68 69 6e 20 74 68 | 65 20 72 65 67 75 6c 61 |ithin th|e regula| |00000840| 72 20 65 78 70 72 65 73 | 73 69 6f 6e 2c 20 77 69 |r expres|sion, wi| |00000850| 74 68 0d 20 20 20 20 20 | 20 20 20 20 20 70 61 72 |th. | par| |00000860| 65 6e 74 68 65 73 69 7a | 65 64 20 65 78 70 72 65 |enthesiz|ed expre| |00000870| 73 73 69 6f 6e 73 20 6e | 75 6d 62 65 72 65 64 20 |ssions n|umbered | |00000880| 69 6e 20 6c 65 66 74 2d | 74 6f 2d 72 69 67 68 74 |in left-|to-right| |00000890| 20 6f 72 64 65 72 20 6f | 66 0d 20 20 20 20 20 20 | order o|f. | |000008a0| 20 20 20 20 74 68 65 69 | 72 20 6f 70 65 6e 69 6e | thei|r openin| |000008b0| 67 20 70 61 72 65 6e 74 | 68 65 73 65 73 2e 0d 0d |g parent|heses...| |000008c0| 0d 0d 20 20 20 20 20 50 | 61 67 65 20 31 20 20 20 |.. P|age 1 | |000008d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |000008e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |000008f0| 20 20 20 20 20 20 20 28 | 70 72 69 6e 74 65 64 20 | (|printed | |00000900| 34 2f 31 30 2f 39 31 29 | 0d 0d 0d 0d 0d 0d 0d 20 |4/10/91)|....... | |00000910| 20 20 20 20 52 45 47 45 | 58 50 28 33 29 20 20 20 | REGE|XP(3) | |00000920| 20 20 20 20 20 20 20 20 | 20 20 55 4e 49 58 20 53 | | UNIX S| |00000930| 79 73 74 65 6d 20 56 20 | 28 6c 6f 63 61 6c 29 20 |ystem V |(local) | |00000940| 20 20 20 20 20 20 20 20 | 20 20 20 20 52 45 47 45 | | REGE| |00000950| 58 50 28 33 29 0d 0d 0d | 0d 20 20 20 20 20 20 20 |XP(3)...|. | |00000960| 20 20 20 52 65 67 73 75 | 62 20 63 6f 70 69 65 73 | Regsu|b copies| |00000970| 20 73 6f 75 72 63 65 20 | 74 6f 20 64 65 73 74 2c | source |to dest,| |00000980| 20 6d 61 6b 69 6e 67 20 | 73 75 62 73 74 69 74 75 | making |substitu| |00000990| 74 69 6f 6e 73 20 61 63 | 63 6f 72 64 69 6e 67 0d |tions ac|cording.| |000009a0| 20 20 20 20 20 20 20 20 | 20 20 74 6f 20 74 68 65 | | to the| |000009b0| 20 6d 6f 73 74 20 72 65 | 63 65 6e 74 20 72 65 67 | most re|cent reg| |000009c0| 65 78 65 63 20 70 65 72 | 66 6f 72 6d 65 64 20 75 |exec per|formed u| |000009d0| 73 69 6e 67 20 70 72 6f | 67 2e 20 20 45 61 63 68 |sing pro|g. Each| |000009e0| 0d 20 20 20 20 20 20 20 | 20 20 20 69 6e 73 74 61 |. | insta| |000009f0| 6e 63 65 20 6f 66 20 60 | 26 27 20 69 6e 20 73 6f |nce of `|&' in so| |00000a00| 75 72 63 65 20 69 73 20 | 72 65 70 6c 61 63 65 64 |urce is |replaced| |00000a10| 20 62 79 20 74 68 65 20 | 73 75 62 73 74 72 69 6e | by the |substrin| |00000a20| 67 0d 20 20 20 20 20 20 | 20 20 20 20 69 6e 64 69 |g. | indi| |00000a30| 63 61 74 65 64 20 62 79 | 20 73 74 61 72 74 70 5b |cated by| startp[| |00000a40| 30 5d 20 61 6e 64 20 65 | 6e 64 70 5b 30 5d 2e 20 |0] and e|ndp[0]. | |00000a50| 20 45 61 63 68 20 69 6e | 73 74 61 6e 63 65 20 6f | Each in|stance o| |00000a60| 66 20 60 5c 6e 27 2c 0d | 20 20 20 20 20 20 20 20 |f `\n',.| | |00000a70| 20 20 77 68 65 72 65 20 | 6e 20 69 73 20 61 20 64 | where |n is a d| |00000a80| 69 67 69 74 2c 20 69 73 | 20 72 65 70 6c 61 63 65 |igit, is| replace| |00000a90| 64 20 62 79 20 74 68 65 | 20 73 75 62 73 74 72 69 |d by the| substri| |00000aa0| 6e 67 20 69 6e 64 69 63 | 61 74 65 64 0d 20 20 20 |ng indic|ated. | |00000ab0| 20 20 20 20 20 20 20 62 | 79 20 73 74 61 72 74 70 | b|y startp| |00000ac0| 5b 6e 5d 20 61 6e 64 20 | 65 6e 64 70 5b 6e 5d 2e |[n] and |endp[n].| |00000ad0| 20 20 54 6f 20 67 65 74 | 20 61 20 6c 69 74 65 72 | To get| a liter| |00000ae0| 61 6c 20 60 26 27 20 6f | 72 20 60 5c 6e 27 20 69 |al `&' o|r `\n' i| |00000af0| 6e 74 6f 0d 20 20 20 20 | 20 20 20 20 20 20 64 65 |nto. | de| |00000b00| 73 74 2c 20 70 72 65 66 | 69 78 20 69 74 20 77 69 |st, pref|ix it wi| |00000b10| 74 68 20 60 5c 27 3b 20 | 74 6f 20 67 65 74 20 61 |th `\'; |to get a| |00000b20| 20 6c 69 74 65 72 61 6c | 20 60 5c 27 20 70 72 65 | literal| `\' pre| |00000b30| 63 65 64 69 6e 67 20 60 | 26 27 0d 20 20 20 20 20 |ceding `|&'. | |00000b40| 20 20 20 20 20 6f 72 20 | 60 5c 6e 27 2c 20 70 72 | or |`\n', pr| |00000b50| 65 66 69 78 20 69 74 20 | 77 69 74 68 20 61 6e 6f |efix it |with ano| |00000b60| 74 68 65 72 20 60 5c 27 | 2e 0d 0d 20 20 20 20 20 |ther `\'|... | |00000b70| 20 20 20 20 20 52 65 67 | 65 72 72 6f 72 20 69 73 | Reg|error is| |00000b80| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 65 76 65 72 | called |whenever| |00000b90| 20 61 6e 20 65 72 72 6f | 72 20 69 73 20 64 65 74 | an erro|r is det| |00000ba0| 65 63 74 65 64 20 69 6e | 20 72 65 67 63 6f 6d 70 |ected in| regcomp| |00000bb0| 2c 0d 20 20 20 20 20 20 | 20 20 20 20 72 65 67 65 |,. | rege| |00000bc0| 78 65 63 2c 20 6f 72 20 | 72 65 67 73 75 62 2e 20 |xec, or |regsub. | |00000bd0| 20 54 68 65 20 64 65 66 | 61 75 6c 74 20 72 65 67 | The def|ault reg| |00000be0| 65 72 72 6f 72 20 77 72 | 69 74 65 73 20 74 68 65 |error wr|ites the| |00000bf0| 20 73 74 72 69 6e 67 0d | 20 20 20 20 20 20 20 20 | string.| | |00000c00| 20 20 6d 73 67 2c 20 77 | 69 74 68 20 61 20 73 75 | msg, w|ith a su| |00000c10| 69 74 61 62 6c 65 20 69 | 6e 64 69 63 61 74 6f 72 |itable i|ndicator| |00000c20| 20 6f 66 20 6f 72 69 67 | 69 6e 2c 20 6f 6e 20 74 | of orig|in, on t| |00000c30| 68 65 20 73 74 61 6e 64 | 61 72 64 0d 20 20 20 20 |he stand|ard. | |00000c40| 20 20 20 20 20 20 65 72 | 72 6f 72 20 6f 75 74 70 | er|ror outp| |00000c50| 75 74 20 61 6e 64 20 69 | 6e 76 6f 6b 65 73 20 65 |ut and i|nvokes e| |00000c60| 78 69 74 28 32 29 2e 20 | 20 52 65 67 65 72 72 6f |xit(2). | Regerro| |00000c70| 72 20 63 61 6e 20 62 65 | 20 72 65 70 6c 61 63 65 |r can be| replace| |00000c80| 64 0d 20 20 20 20 20 20 | 20 20 20 20 62 79 20 74 |d. | by t| |00000c90| 68 65 20 75 73 65 72 20 | 69 66 20 6f 74 68 65 72 |he user |if other| |00000ca0| 20 61 63 74 69 6f 6e 73 | 20 61 72 65 20 64 65 73 | actions| are des| |00000cb0| 69 72 61 62 6c 65 2e 0d | 0d 20 20 20 20 20 52 45 |irable..|. RE| |00000cc0| 47 55 4c 41 52 20 45 58 | 50 52 45 53 53 49 4f 4e |GULAR EX|PRESSION| |00000cd0| 20 53 59 4e 54 41 58 0d | 20 20 20 20 20 20 20 20 | SYNTAX.| | |00000ce0| 20 20 41 20 72 65 67 75 | 6c 61 72 20 65 78 70 72 | A regu|lar expr| |00000cf0| 65 73 73 69 6f 6e 20 69 | 73 20 7a 65 72 6f 20 6f |ession i|s zero o| |00000d00| 72 20 6d 6f 72 65 20 62 | 72 61 6e 63 68 65 73 2c |r more b|ranches,| |00000d10| 20 73 65 70 61 72 61 74 | 65 64 20 62 79 0d 20 20 | separat|ed by. | |00000d20| 20 20 20 20 20 20 20 20 | 60 7c 27 2e 20 20 49 74 | |`|'. It| |00000d30| 20 6d 61 74 63 68 65 73 | 20 61 6e 79 74 68 69 6e | matches| anythin| |00000d40| 67 20 74 68 61 74 20 6d | 61 74 63 68 65 73 20 6f |g that m|atches o| |00000d50| 6e 65 20 6f 66 20 74 68 | 65 20 62 72 61 6e 63 68 |ne of th|e branch| |00000d60| 65 73 2e 0d 0d 20 20 20 | 20 20 20 20 20 20 20 41 |es... | A| |00000d70| 20 62 72 61 6e 63 68 20 | 69 73 20 7a 65 72 6f 20 | branch |is zero | |00000d80| 6f 72 20 6d 6f 72 65 20 | 70 69 65 63 65 73 2c 20 |or more |pieces, | |00000d90| 63 6f 6e 63 61 74 65 6e | 61 74 65 64 2e 20 20 49 |concaten|ated. I| |00000da0| 74 20 6d 61 74 63 68 65 | 73 20 61 0d 20 20 20 20 |t matche|s a. | |00000db0| 20 20 20 20 20 20 6d 61 | 74 63 68 20 66 6f 72 20 | ma|tch for | |00000dc0| 74 68 65 20 66 69 72 73 | 74 2c 20 66 6f 6c 6c 6f |the firs|t, follo| |00000dd0| 77 65 64 20 62 79 20 61 | 20 6d 61 74 63 68 20 66 |wed by a| match f| |00000de0| 6f 72 20 74 68 65 20 73 | 65 63 6f 6e 64 2c 0d 20 |or the s|econd,. | |00000df0| 20 20 20 20 20 20 20 20 | 20 65 74 63 2e 0d 0d 20 | | etc... | |00000e00| 20 20 20 20 20 20 20 20 | 20 41 20 70 69 65 63 65 | | A piece| |00000e10| 20 69 73 20 61 6e 20 61 | 74 6f 6d 20 70 6f 73 73 | is an a|tom poss| |00000e20| 69 62 6c 79 20 66 6f 6c | 6c 6f 77 65 64 20 62 79 |ibly fol|lowed by| |00000e30| 20 60 2a 27 2c 20 60 2b | 27 2c 20 6f 72 20 60 3f | `*', `+|', or `?| |00000e40| 27 2e 0d 20 20 20 20 20 | 20 20 20 20 20 41 6e 20 |'.. | An | |00000e50| 61 74 6f 6d 20 66 6f 6c | 6c 6f 77 65 64 20 62 79 |atom fol|lowed by| |00000e60| 20 60 2a 27 20 6d 61 74 | 63 68 65 73 20 61 20 73 | `*' mat|ches a s| |00000e70| 65 71 75 65 6e 63 65 20 | 6f 66 20 30 20 6f 72 20 |equence |of 0 or | |00000e80| 6d 6f 72 65 0d 20 20 20 | 20 20 20 20 20 20 20 6d |more. | m| |00000e90| 61 74 63 68 65 73 20 6f | 66 20 74 68 65 20 61 74 |atches o|f the at| |00000ea0| 6f 6d 2e 20 20 41 6e 20 | 61 74 6f 6d 20 66 6f 6c |om. An |atom fol| |00000eb0| 6c 6f 77 65 64 20 62 79 | 20 60 2b 27 20 6d 61 74 |lowed by| `+' mat| |00000ec0| 63 68 65 73 20 61 0d 20 | 20 20 20 20 20 20 20 20 |ches a. | | |00000ed0| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 31 20 6f | sequenc|e of 1 o| |00000ee0| 72 20 6d 6f 72 65 20 6d | 61 74 63 68 65 73 20 6f |r more m|atches o| |00000ef0| 66 20 74 68 65 20 61 74 | 6f 6d 2e 20 20 41 6e 20 |f the at|om. An | |00000f00| 61 74 6f 6d 20 66 6f 6c | 6c 6f 77 65 64 0d 20 20 |atom fol|lowed. | |00000f10| 20 20 20 20 20 20 20 20 | 62 79 20 60 3f 27 20 6d | |by `?' m| |00000f20| 61 74 63 68 65 73 20 61 | 20 6d 61 74 63 68 20 6f |atches a| match o| |00000f30| 66 20 74 68 65 20 61 74 | 6f 6d 2c 20 6f 72 20 74 |f the at|om, or t| |00000f40| 68 65 20 6e 75 6c 6c 20 | 73 74 72 69 6e 67 2e 0d |he null |string..| |00000f50| 0d 20 20 20 20 20 20 20 | 20 20 20 41 6e 20 61 74 |. | An at| |00000f60| 6f 6d 20 69 73 20 61 20 | 72 65 67 75 6c 61 72 20 |om is a |regular | |00000f70| 65 78 70 72 65 73 73 69 | 6f 6e 20 69 6e 20 70 61 |expressi|on in pa| |00000f80| 72 65 6e 74 68 65 73 65 | 73 20 28 6d 61 74 63 68 |renthese|s (match| |00000f90| 69 6e 67 20 61 0d 20 20 | 20 20 20 20 20 20 20 20 |ing a. | | |00000fa0| 6d 61 74 63 68 20 66 6f | 72 20 74 68 65 20 72 65 |match fo|r the re| |00000fb0| 67 75 6c 61 72 20 65 78 | 70 72 65 73 73 69 6f 6e |gular ex|pression| |00000fc0| 29 2c 20 61 20 72 61 6e | 67 65 20 28 73 65 65 20 |), a ran|ge (see | |00000fd0| 62 65 6c 6f 77 29 2c 20 | 60 2e 27 0d 20 20 20 20 |below), |`.'. | |00000fe0| 20 20 20 20 20 20 28 6d | 61 74 63 68 69 6e 67 20 | (m|atching | |00000ff0| 61 6e 79 20 73 69 6e 67 | 6c 65 20 63 68 61 72 61 |any sing|le chara| |00001000| 63 74 65 72 29 2c 20 60 | 5e 27 20 28 6d 61 74 63 |cter), `|^' (matc| |00001010| 68 69 6e 67 20 74 68 65 | 20 6e 75 6c 6c 0d 20 20 |hing the| null. | |00001020| 20 20 20 20 20 20 20 20 | 73 74 72 69 6e 67 20 61 | |string a| |00001030| 74 20 74 68 65 20 62 65 | 67 69 6e 6e 69 6e 67 20 |t the be|ginning | |00001040| 6f 66 20 74 68 65 20 69 | 6e 70 75 74 20 73 74 72 |of the i|nput str| |00001050| 69 6e 67 29 2c 20 60 24 | 27 20 28 6d 61 74 63 68 |ing), `$|' (match| |00001060| 69 6e 67 0d 20 20 20 20 | 20 20 20 20 20 20 74 68 |ing. | th| |00001070| 65 20 6e 75 6c 6c 20 73 | 74 72 69 6e 67 20 61 74 |e null s|tring at| |00001080| 20 74 68 65 20 65 6e 64 | 20 6f 66 20 74 68 65 20 | the end| of the | |00001090| 69 6e 70 75 74 20 73 74 | 72 69 6e 67 29 2c 20 61 |input st|ring), a| |000010a0| 20 60 5c 27 0d 20 20 20 | 20 20 20 20 20 20 20 66 | `\'. | f| |000010b0| 6f 6c 6c 6f 77 65 64 20 | 62 79 20 61 20 73 69 6e |ollowed |by a sin| |000010c0| 67 6c 65 20 63 68 61 72 | 61 63 74 65 72 20 28 6d |gle char|acter (m| |000010d0| 61 74 63 68 69 6e 67 20 | 74 68 61 74 20 63 68 61 |atching |that cha| |000010e0| 72 61 63 74 65 72 29 2c | 20 6f 72 0d 20 20 20 20 |racter),| or. | |000010f0| 20 20 20 20 20 20 61 20 | 73 69 6e 67 6c 65 20 63 | a |single c| |00001100| 68 61 72 61 63 74 65 72 | 20 77 69 74 68 20 6e 6f |haracter| with no| |00001110| 20 6f 74 68 65 72 20 73 | 69 67 6e 69 66 69 63 61 | other s|ignifica| |00001120| 6e 63 65 20 28 6d 61 74 | 63 68 69 6e 67 20 74 68 |nce (mat|ching th| |00001130| 61 74 0d 20 20 20 20 20 | 20 20 20 20 20 63 68 61 |at. | cha| |00001140| 72 61 63 74 65 72 29 2e | 0d 0d 20 20 20 20 20 20 |racter).|.. | |00001150| 20 20 20 20 41 20 72 61 | 6e 67 65 20 69 73 20 61 | A ra|nge is a| |00001160| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 63 68 61 | sequenc|e of cha| |00001170| 72 61 63 74 65 72 73 20 | 65 6e 63 6c 6f 73 65 64 |racters |enclosed| |00001180| 20 69 6e 20 60 5b 5d 27 | 2e 20 20 49 74 0d 20 20 | in `[]'|. It. | |00001190| 20 20 20 20 20 20 20 20 | 6e 6f 72 6d 61 6c 6c 79 | |normally| |000011a0| 20 6d 61 74 63 68 65 73 | 20 61 6e 79 20 73 69 6e | matches| any sin| |000011b0| 67 6c 65 20 63 68 61 72 | 61 63 74 65 72 20 66 72 |gle char|acter fr| |000011c0| 6f 6d 20 74 68 65 20 73 | 65 71 75 65 6e 63 65 2e |om the s|equence.| |000011d0| 20 20 49 66 0d 20 20 20 | 20 20 20 20 20 20 20 74 | If. | t| |000011e0| 68 65 20 73 65 71 75 65 | 6e 63 65 20 62 65 67 69 |he seque|nce begi| |000011f0| 6e 73 20 77 69 74 68 20 | 60 5e 27 2c 20 69 74 20 |ns with |`^', it | |00001200| 6d 61 74 63 68 65 73 20 | 61 6e 79 20 73 69 6e 67 |matches |any sing| |00001210| 6c 65 0d 20 20 20 20 20 | 20 20 20 20 20 63 68 61 |le. | cha| |00001220| 72 61 63 74 65 72 20 6e | 6f 74 20 66 72 6f 6d 20 |racter n|ot from | |00001230| 74 68 65 20 72 65 73 74 | 20 6f 66 20 74 68 65 20 |the rest| of the | |00001240| 73 65 71 75 65 6e 63 65 | 2e 20 20 49 66 20 74 77 |sequence|. If tw| |00001250| 6f 0d 20 20 20 20 20 20 | 20 20 20 20 63 68 61 72 |o. | char| |00001260| 61 63 74 65 72 73 20 69 | 6e 20 74 68 65 20 73 65 |acters i|n the se| |00001270| 71 75 65 6e 63 65 20 61 | 72 65 20 73 65 70 61 72 |quence a|re separ| |00001280| 61 74 65 64 20 62 79 20 | 60 2d 27 2c 20 74 68 69 |ated by |`-', thi| |00001290| 73 20 69 73 0d 20 20 20 | 20 20 20 20 20 20 20 73 |s is. | s| |000012a0| 68 6f 72 74 68 61 6e 64 | 20 66 6f 72 20 74 68 65 |horthand| for the| |000012b0| 20 66 75 6c 6c 20 6c 69 | 73 74 20 6f 66 20 41 53 | full li|st of AS| |000012c0| 43 49 49 20 63 68 61 72 | 61 63 74 65 72 73 20 62 |CII char|acters b| |000012d0| 65 74 77 65 65 6e 20 74 | 68 65 6d 0d 20 20 20 20 |etween t|hem. | |000012e0| 20 20 20 20 20 20 28 65 | 2e 67 2e 20 60 5b 30 2d | (e|.g. `[0-| |000012f0| 39 5d 27 20 6d 61 74 63 | 68 65 73 20 61 6e 79 20 |9]' matc|hes any | |00001300| 64 65 63 69 6d 61 6c 20 | 64 69 67 69 74 29 2e 20 |decimal |digit). | |00001310| 20 54 6f 20 69 6e 63 6c | 75 64 65 20 61 0d 20 20 | To incl|ude a. | |00001320| 20 20 20 20 20 20 20 20 | 6c 69 74 65 72 61 6c 20 | |literal | |00001330| 60 5d 27 20 69 6e 20 74 | 68 65 20 73 65 71 75 65 |`]' in t|he seque| |00001340| 6e 63 65 2c 20 6d 61 6b | 65 20 69 74 20 74 68 65 |nce, mak|e it the| |00001350| 20 66 69 72 73 74 20 63 | 68 61 72 61 63 74 65 72 | first c|haracter| |00001360| 0d 20 20 20 20 20 20 20 | 20 20 20 28 66 6f 6c 6c |. | (foll| |00001370| 6f 77 69 6e 67 20 61 20 | 70 6f 73 73 69 62 6c 65 |owing a |possible| |00001380| 20 60 5e 27 29 2e 20 20 | 54 6f 20 69 6e 63 6c 75 | `^'). |To inclu| |00001390| 64 65 20 61 20 6c 69 74 | 65 72 61 6c 20 60 2d 27 |de a lit|eral `-'| |000013a0| 2c 20 6d 61 6b 65 0d 20 | 20 20 20 20 20 20 20 20 |, make. | | |000013b0| 20 69 74 20 74 68 65 20 | 66 69 72 73 74 20 6f 72 | it the |first or| |000013c0| 20 6c 61 73 74 20 63 68 | 61 72 61 63 74 65 72 2e | last ch|aracter.| |000013d0| 0d 0d 20 20 20 20 20 41 | 4d 42 49 47 55 49 54 59 |.. A|MBIGUITY| |000013e0| 0d 20 20 20 20 20 20 20 | 20 20 20 49 66 20 61 20 |. | If a | |000013f0| 72 65 67 75 6c 61 72 20 | 65 78 70 72 65 73 73 69 |regular |expressi| |00001400| 6f 6e 20 63 6f 75 6c 64 | 20 6d 61 74 63 68 20 74 |on could| match t| |00001410| 77 6f 20 64 69 66 66 65 | 72 65 6e 74 20 70 61 72 |wo diffe|rent par| |00001420| 74 73 20 6f 66 0d 20 20 | 20 20 20 20 20 20 20 20 |ts of. | | |00001430| 74 68 65 20 69 6e 70 75 | 74 20 73 74 72 69 6e 67 |the inpu|t string| |00001440| 2c 20 69 74 20 77 69 6c | 6c 20 6d 61 74 63 68 20 |, it wil|l match | |00001450| 74 68 65 20 6f 6e 65 20 | 77 68 69 63 68 20 62 65 |the one |which be| |00001460| 67 69 6e 73 0d 0d 0d 0d | 20 20 20 20 20 50 61 67 |gins....| Pag| |00001470| 65 20 32 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e 2 | | |00001480| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |00001490| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 28 70 72 | | (pr| |000014a0| 69 6e 74 65 64 20 34 2f | 31 30 2f 39 31 29 0d 0d |inted 4/|10/91)..| |000014b0| 0d 0d 0d 0d 0d 20 20 20 | 20 20 52 45 47 45 58 50 |..... | REGEXP| |000014c0| 28 33 29 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |(3) | | |000014d0| 55 4e 49 58 20 53 79 73 | 74 65 6d 20 56 20 28 6c |UNIX Sys|tem V (l| |000014e0| 6f 63 61 6c 29 20 20 20 | 20 20 20 20 20 20 20 20 |ocal) | | |000014f0| 20 20 52 45 47 45 58 50 | 28 33 29 0d 0d 0d 0d 20 | REGEXP|(3).... | |00001500| 20 20 20 20 20 20 20 20 | 20 65 61 72 6c 69 65 73 | | earlies| |00001510| 74 2e 20 20 49 66 20 62 | 6f 74 68 20 62 65 67 69 |t. If b|oth begi| |00001520| 6e 20 69 6e 20 74 68 65 | 20 73 61 6d 65 20 70 6c |n in the| same pl| |00001530| 61 63 65 20 20 20 20 62 | 75 74 20 6d 61 74 63 68 |ace b|ut match| |00001540| 0d 20 20 20 20 20 20 20 | 20 20 20 64 69 66 66 65 |. | diffe| |00001550| 72 65 6e 74 20 6c 65 6e | 67 74 68 73 2c 20 6f 72 |rent len|gths, or| |00001560| 20 6d 61 74 63 68 20 74 | 68 65 20 73 61 6d 65 20 | match t|he same | |00001570| 6c 65 6e 67 74 68 20 69 | 6e 20 64 69 66 66 65 72 |length i|n differ| |00001580| 65 6e 74 0d 20 20 20 20 | 20 20 20 20 20 20 77 61 |ent. | wa| |00001590| 79 73 2c 20 6c 69 66 65 | 20 67 65 74 73 20 6d 65 |ys, life| gets me| |000015a0| 73 73 69 65 72 2c 20 61 | 73 20 66 6f 6c 6c 6f 77 |ssier, a|s follow| |000015b0| 73 2e 0d 0d 20 20 20 20 | 20 20 20 20 20 20 49 6e |s... | In| |000015c0| 20 67 65 6e 65 72 61 6c | 2c 20 74 68 65 20 70 6f | general|, the po| |000015d0| 73 73 69 62 69 6c 69 74 | 69 65 73 20 69 6e 20 61 |ssibilit|ies in a| |000015e0| 20 6c 69 73 74 20 6f 66 | 20 62 72 61 6e 63 68 65 | list of| branche| |000015f0| 73 20 61 72 65 0d 20 20 | 20 20 20 20 20 20 20 20 |s are. | | |00001600| 63 6f 6e 73 69 64 65 72 | 65 64 20 69 6e 20 6c 65 |consider|ed in le| |00001610| 66 74 2d 74 6f 2d 72 69 | 67 68 74 20 6f 72 64 65 |ft-to-ri|ght orde| |00001620| 72 2c 20 74 68 65 20 70 | 6f 73 73 69 62 69 6c 69 |r, the p|ossibili| |00001630| 74 69 65 73 20 66 6f 72 | 0d 20 20 20 20 20 20 20 |ties for|. | |00001640| 20 20 20 60 2a 27 2c 20 | 60 2b 27 2c 20 61 6e 64 | `*', |`+', and| |00001650| 20 60 3f 27 20 61 72 65 | 20 63 6f 6e 73 69 64 65 | `?' are| conside| |00001660| 72 65 64 20 6c 6f 6e 67 | 65 73 74 2d 66 69 72 73 |red long|est-firs| |00001670| 74 2c 20 6e 65 73 74 65 | 64 0d 20 20 20 20 20 20 |t, neste|d. | |00001680| 20 20 20 20 63 6f 6e 73 | 74 72 75 63 74 73 20 61 | cons|tructs a| |00001690| 72 65 20 63 6f 6e 73 69 | 64 65 72 65 64 20 66 72 |re consi|dered fr| |000016a0| 6f 6d 20 74 68 65 20 6f | 75 74 65 72 6d 6f 73 74 |om the o|utermost| |000016b0| 20 69 6e 2c 20 61 6e 64 | 0d 20 20 20 20 20 20 20 | in, and|. | |000016c0| 20 20 20 63 6f 6e 63 61 | 74 65 6e 61 74 65 64 20 | conca|tenated | |000016d0| 63 6f 6e 73 74 72 75 63 | 74 73 20 61 72 65 20 63 |construc|ts are c| |000016e0| 6f 6e 73 69 64 65 72 65 | 64 20 6c 65 66 74 6d 6f |onsidere|d leftmo| |000016f0| 73 74 2d 66 69 72 73 74 | 2e 20 20 54 68 65 0d 20 |st-first|. The. | |00001700| 20 20 20 20 20 20 20 20 | 20 6d 61 74 63 68 20 74 | | match t| |00001710| 68 61 74 20 77 69 6c 6c | 20 62 65 20 63 68 6f 73 |hat will| be chos| |00001720| 65 6e 20 69 73 20 74 68 | 65 20 6f 6e 65 20 74 68 |en is th|e one th| |00001730| 61 74 20 75 73 65 73 20 | 74 68 65 20 65 61 72 6c |at uses |the earl| |00001740| 69 65 73 74 0d 20 20 20 | 20 20 20 20 20 20 20 70 |iest. | p| |00001750| 6f 73 73 69 62 69 6c 69 | 74 79 20 69 6e 20 74 68 |ossibili|ty in th| |00001760| 65 20 66 69 72 73 74 20 | 63 68 6f 69 63 65 20 74 |e first |choice t| |00001770| 68 61 74 20 68 61 73 20 | 74 6f 20 62 65 20 6d 61 |hat has |to be ma| |00001780| 64 65 2e 20 20 49 66 0d | 20 20 20 20 20 20 20 20 |de. If.| | |00001790| 20 20 74 68 65 72 65 20 | 69 73 20 6d 6f 72 65 20 | there |is more | |000017a0| 74 68 61 6e 20 6f 6e 65 | 20 63 68 6f 69 63 65 2c |than one| choice,| |000017b0| 20 74 68 65 20 6e 65 78 | 74 20 77 69 6c 6c 20 62 | the nex|t will b| |000017c0| 65 20 6d 61 64 65 20 69 | 6e 20 74 68 65 0d 20 20 |e made i|n the. | |000017d0| 20 20 20 20 20 20 20 20 | 73 61 6d 65 20 6d 61 6e | |same man| |000017e0| 6e 65 72 20 28 65 61 72 | 6c 69 65 73 74 20 70 6f |ner (ear|liest po| |000017f0| 73 73 69 62 69 6c 69 74 | 79 29 20 73 75 62 6a 65 |ssibilit|y) subje| |00001800| 63 74 20 74 6f 20 74 68 | 65 20 64 65 63 69 73 69 |ct to th|e decisi| |00001810| 6f 6e 0d 20 20 20 20 20 | 20 20 20 20 20 6f 6e 20 |on. | on | |00001820| 74 68 65 20 66 69 72 73 | 74 20 63 68 6f 69 63 65 |the firs|t choice| |00001830| 2e 20 20 41 6e 64 20 73 | 6f 20 66 6f 72 74 68 2e |. And s|o forth.| |00001840| 0d 0d 20 20 20 20 20 20 | 20 20 20 20 46 6f 72 20 |.. | For | |00001850| 65 78 61 6d 70 6c 65 2c | 20 60 28 61 62 7c 61 29 |example,| `(ab|a)| |00001860| 62 2a 63 27 20 63 6f 75 | 6c 64 20 6d 61 74 63 68 |b*c' cou|ld match| |00001870| 20 60 61 62 63 27 20 69 | 6e 20 6f 6e 65 20 6f 66 | `abc' i|n one of| |00001880| 20 74 77 6f 0d 20 20 20 | 20 20 20 20 20 20 20 77 | two. | w| |00001890| 61 79 73 2e 20 20 54 68 | 65 20 66 69 72 73 74 20 |ays. Th|e first | |000018a0| 63 68 6f 69 63 65 20 69 | 73 20 62 65 74 77 65 65 |choice i|s betwee| |000018b0| 6e 20 60 61 62 27 20 61 | 6e 64 20 60 61 27 3b 20 |n `ab' a|nd `a'; | |000018c0| 73 69 6e 63 65 20 60 61 | 62 27 0d 20 20 20 20 20 |since `a|b'. | |000018d0| 20 20 20 20 20 69 73 20 | 65 61 72 6c 69 65 72 2c | is |earlier,| |000018e0| 20 61 6e 64 20 64 6f 65 | 73 20 6c 65 61 64 20 74 | and doe|s lead t| |000018f0| 6f 20 61 20 73 75 63 63 | 65 73 73 66 75 6c 20 6f |o a succ|essful o| |00001900| 76 65 72 61 6c 6c 20 6d | 61 74 63 68 2c 20 69 74 |verall m|atch, it| |00001910| 0d 20 20 20 20 20 20 20 | 20 20 20 69 73 20 63 68 |. | is ch| |00001920| 6f 73 65 6e 2e 20 20 53 | 69 6e 63 65 20 74 68 65 |osen. S|ince the| |00001930| 20 60 62 27 20 69 73 20 | 61 6c 72 65 61 64 79 20 | `b' is |already | |00001940| 73 70 6f 6b 65 6e 20 66 | 6f 72 2c 20 74 68 65 20 |spoken f|or, the | |00001950| 60 62 2a 27 0d 20 20 20 | 20 20 20 20 20 20 20 6d |`b*'. | m| |00001960| 75 73 74 20 6d 61 74 63 | 68 20 69 74 73 20 6c 61 |ust matc|h its la| |00001970| 73 74 20 70 6f 73 73 69 | 62 69 6c 69 74 79 2d 74 |st possi|bility-t| |00001980| 68 65 20 65 6d 70 74 79 | 20 73 74 72 69 6e 67 2d |he empty| string-| |00001990| 73 69 6e 63 65 20 69 74 | 0d 20 20 20 20 20 20 20 |since it|. | |000019a0| 20 20 20 6d 75 73 74 20 | 72 65 73 70 65 63 74 20 | must |respect | |000019b0| 74 68 65 20 65 61 72 6c | 69 65 72 20 63 68 6f 69 |the earl|ier choi| |000019c0| 63 65 2e 0d 0d 20 20 20 | 20 20 20 20 20 20 20 49 |ce... | I| |000019d0| 6e 20 74 68 65 20 70 61 | 72 74 69 63 75 6c 61 72 |n the pa|rticular| |000019e0| 20 63 61 73 65 20 77 68 | 65 72 65 20 6e 6f 20 60 | case wh|ere no `| |000019f0| 7c 27 73 20 61 72 65 20 | 70 72 65 73 65 6e 74 20 ||'s are |present | |00001a00| 61 6e 64 20 74 68 65 72 | 65 0d 20 20 20 20 20 20 |and ther|e. | |00001a10| 20 20 20 20 69 73 20 6f | 6e 6c 79 20 6f 6e 65 20 | is o|nly one | |00001a20| 60 2a 27 2c 20 60 2b 27 | 2c 20 6f 72 20 60 3f 27 |`*', `+'|, or `?'| |00001a30| 2c 20 74 68 65 20 6e 65 | 74 20 65 66 66 65 63 74 |, the ne|t effect| |00001a40| 20 69 73 20 74 68 61 74 | 20 74 68 65 0d 20 20 20 | is that| the. | |00001a50| 20 20 20 20 20 20 20 6c | 6f 6e 67 65 73 74 20 70 | l|ongest p| |00001a60| 6f 73 73 69 62 6c 65 20 | 6d 61 74 63 68 20 77 69 |ossible |match wi| |00001a70| 6c 6c 20 62 65 20 63 68 | 6f 73 65 6e 2e 20 20 53 |ll be ch|osen. S| |00001a80| 6f 20 60 61 62 2a 27 2c | 20 70 72 65 73 65 6e 74 |o `ab*',| present| |00001a90| 65 64 0d 20 20 20 20 20 | 20 20 20 20 20 77 69 74 |ed. | wit| |00001aa0| 68 20 60 78 61 62 62 62 | 62 79 27 2c 20 77 69 6c |h `xabbb|by', wil| |00001ab0| 6c 20 6d 61 74 63 68 20 | 60 61 62 62 62 62 27 2e |l match |`abbbb'.| |00001ac0| 20 20 4e 6f 74 65 20 74 | 68 61 74 20 69 66 20 60 | Note t|hat if `| |00001ad0| 61 62 2a 27 20 69 73 0d | 20 20 20 20 20 20 20 20 |ab*' is.| | |00001ae0| 20 20 74 72 69 65 64 20 | 61 67 61 69 6e 73 74 20 | tried |against | |00001af0| 60 78 61 62 79 61 62 62 | 62 7a 27 2c 20 69 74 20 |`xabyabb|bz', it | |00001b00| 77 69 6c 6c 20 6d 61 74 | 63 68 20 60 61 62 27 20 |will mat|ch `ab' | |00001b10| 6a 75 73 74 20 61 66 74 | 65 72 0d 20 20 20 20 20 |just aft|er. | |00001b20| 20 20 20 20 20 60 78 27 | 2c 20 64 75 65 20 74 6f | `x'|, due to| |00001b30| 20 74 68 65 20 62 65 67 | 69 6e 73 2d 65 61 72 6c | the beg|ins-earl| |00001b40| 69 65 73 74 20 72 75 6c | 65 2e 20 20 28 49 6e 20 |iest rul|e. (In | |00001b50| 65 66 66 65 63 74 2c 20 | 74 68 65 0d 20 20 20 20 |effect, |the. | |00001b60| 20 20 20 20 20 20 64 65 | 63 69 73 69 6f 6e 20 6f | de|cision o| |00001b70| 6e 20 77 68 65 72 65 20 | 74 6f 20 73 74 61 72 74 |n where |to start| |00001b80| 20 74 68 65 20 6d 61 74 | 63 68 20 69 73 20 74 68 | the mat|ch is th| |00001b90| 65 20 66 69 72 73 74 20 | 63 68 6f 69 63 65 20 74 |e first |choice t| |00001ba0| 6f 0d 20 20 20 20 20 20 | 20 20 20 20 62 65 20 6d |o. | be m| |00001bb0| 61 64 65 2c 20 68 65 6e | 63 65 20 73 75 62 73 65 |ade, hen|ce subse| |00001bc0| 71 75 65 6e 74 20 63 68 | 6f 69 63 65 73 20 6d 75 |quent ch|oices mu| |00001bd0| 73 74 20 72 65 73 70 65 | 63 74 20 69 74 20 65 76 |st respe|ct it ev| |00001be0| 65 6e 20 69 66 0d 20 20 | 20 20 20 20 20 20 20 20 |en if. | | |00001bf0| 74 68 69 73 20 6c 65 61 | 64 73 20 74 68 65 6d 20 |this lea|ds them | |00001c00| 74 6f 20 6c 65 73 73 2d | 70 72 65 66 65 72 72 65 |to less-|preferre| |00001c10| 64 20 61 6c 74 65 72 6e | 61 74 69 76 65 73 2e 29 |d altern|atives.)| |00001c20| 0d 0d 20 20 20 20 20 53 | 45 45 20 41 4c 53 4f 0d |.. S|EE ALSO.| |00001c30| 20 20 20 20 20 20 20 20 | 20 20 65 67 72 65 70 28 | | egrep(| |00001c40| 31 29 2c 20 65 78 70 72 | 28 31 29 0d 0d 20 20 20 |1), expr|(1).. | |00001c50| 20 20 44 49 41 47 4e 4f | 53 54 49 43 53 0d 20 20 | DIAGNO|STICS. | |00001c60| 20 20 20 20 20 20 20 20 | 52 65 67 63 6f 6d 70 20 | |Regcomp | |00001c70| 72 65 74 75 72 6e 73 20 | 4e 55 4c 4c 20 66 6f 72 |returns |NULL for| |00001c80| 20 61 20 66 61 69 6c 75 | 72 65 20 28 72 65 67 65 | a failu|re (rege| |00001c90| 72 72 6f 72 20 70 65 72 | 6d 69 74 74 69 6e 67 29 |rror per|mitting)| |00001ca0| 2c 0d 20 20 20 20 20 20 | 20 20 20 20 77 68 65 72 |,. | wher| |00001cb0| 65 20 66 61 69 6c 75 72 | 65 73 20 61 72 65 20 73 |e failur|es are s| |00001cc0| 79 6e 74 61 78 20 65 72 | 72 6f 72 73 2c 20 65 78 |yntax er|rors, ex| |00001cd0| 63 65 65 64 69 6e 67 20 | 69 6d 70 6c 65 6d 65 6e |ceeding |implemen| |00001ce0| 74 61 74 69 6f 6e 0d 20 | 20 20 20 20 20 20 20 20 |tation. | | |00001cf0| 20 6c 69 6d 69 74 73 2c | 20 6f 72 20 61 70 70 6c | limits,| or appl| |00001d00| 79 69 6e 67 20 60 2b 27 | 20 6f 72 20 60 2a 27 20 |ying `+'| or `*' | |00001d10| 74 6f 20 61 20 70 6f 73 | 73 69 62 6c 79 2d 6e 75 |to a pos|sibly-nu| |00001d20| 6c 6c 20 6f 70 65 72 61 | 6e 64 2e 0d 0d 20 20 20 |ll opera|nd... | |00001d30| 20 20 48 49 53 54 4f 52 | 59 0d 20 20 20 20 20 20 | HISTOR|Y. | |00001d40| 20 20 20 20 42 6f 74 68 | 20 63 6f 64 65 20 61 6e | Both| code an| |00001d50| 64 20 6d 61 6e 75 61 6c | 20 70 61 67 65 20 77 65 |d manual| page we| |00001d60| 72 65 20 77 72 69 74 74 | 65 6e 20 61 74 20 55 20 |re writt|en at U | |00001d70| 6f 66 20 54 2e 20 20 54 | 68 65 79 20 61 72 65 0d |of T. T|hey are.| |00001d80| 20 20 20 20 20 20 20 20 | 20 20 69 6e 74 65 6e 64 | | intend| |00001d90| 65 64 20 74 6f 20 62 65 | 20 63 6f 6d 70 61 74 69 |ed to be| compati| |00001da0| 62 6c 65 20 77 69 74 68 | 20 74 68 65 20 42 65 6c |ble with| the Bel| |00001db0| 6c 20 56 38 20 72 65 67 | 65 78 70 28 33 29 2c 20 |l V8 reg|exp(3), | |00001dc0| 62 75 74 0d 20 20 20 20 | 20 20 20 20 20 20 61 72 |but. | ar| |00001dd0| 65 20 6e 6f 74 20 64 65 | 72 69 76 65 64 20 66 72 |e not de|rived fr| |00001de0| 6f 6d 20 42 65 6c 6c 20 | 63 6f 64 65 2e 0d 0d 20 |om Bell |code... | |00001df0| 20 20 20 20 42 55 47 53 | 0d 20 20 20 20 20 20 20 | BUGS|. | |00001e00| 20 20 20 45 6d 70 74 79 | 20 62 72 61 6e 63 68 65 | Empty| branche| |00001e10| 73 20 61 6e 64 20 65 6d | 70 74 79 20 72 65 67 75 |s and em|pty regu| |00001e20| 6c 61 72 20 65 78 70 72 | 65 73 73 69 6f 6e 73 20 |lar expr|essions | |00001e30| 61 72 65 20 6e 6f 74 0d | 20 20 20 20 20 20 20 20 |are not.| | |00001e40| 20 20 70 6f 72 74 61 62 | 6c 65 20 74 6f 20 56 38 | portab|le to V8| |00001e50| 2e 0d 0d 20 20 20 20 20 | 20 20 20 20 20 54 68 65 |... | The| |00001e60| 20 72 65 73 74 72 69 63 | 74 69 6f 6e 20 61 67 61 | restric|tion aga| |00001e70| 69 6e 73 74 20 61 70 70 | 6c 79 69 6e 67 20 60 2a |inst app|lying `*| |00001e80| 27 20 6f 72 20 60 2b 27 | 20 74 6f 20 61 20 70 6f |' or `+'| to a po| |00001e90| 73 73 69 62 6c 79 2d 0d | 20 20 20 20 20 20 20 20 |ssibly-.| | |00001ea0| 20 20 6e 75 6c 6c 20 6f | 70 65 72 61 6e 64 20 69 | null o|perand i| |00001eb0| 73 20 61 6e 20 61 72 74 | 69 66 61 63 74 20 6f 66 |s an art|ifact of| |00001ec0| 20 74 68 65 20 73 69 6d | 70 6c 69 73 74 69 63 0d | the sim|plistic.| |00001ed0| 20 20 20 20 20 20 20 20 | 20 20 69 6d 70 6c 65 6d | | implem| |00001ee0| 65 6e 74 61 74 69 6f 6e | 2e 0d 0d 0d 0d 20 20 20 |entation|..... | |00001ef0| 20 20 50 61 67 65 20 33 | 20 20 20 20 20 20 20 20 | Page 3| | |00001f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |00001f10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |00001f20| 20 20 28 70 72 69 6e 74 | 65 64 20 34 2f 31 30 2f | (print|ed 4/10/| |00001f30| 39 31 29 0d 0d 0d 0d 0d | 0d 0d 20 20 20 20 20 52 |91).....|.. R| |00001f40| 45 47 45 58 50 28 33 29 | 20 20 20 20 20 20 20 20 |EGEXP(3)| | |00001f50| 20 20 20 20 20 55 4e 49 | 58 20 53 79 73 74 65 6d | UNI|X System| |00001f60| 20 56 20 28 6c 6f 63 61 | 6c 29 20 20 20 20 20 20 | V (loca|l) | |00001f70| 20 20 20 20 20 20 20 52 | 45 47 45 58 50 28 33 29 | R|EGEXP(3)| |00001f80| 0d 0d 0d 0d 20 20 20 20 | 20 20 20 20 20 20 44 6f |.... | Do| |00001f90| 65 73 20 6e 6f 74 20 73 | 75 70 70 6f 72 74 20 65 |es not s|upport e| |00001fa0| 67 72 65 70 27 73 20 6e | 65 77 6c 69 6e 65 2d 73 |grep's n|ewline-s| |00001fb0| 65 70 61 72 61 74 65 64 | 20 62 72 61 6e 63 68 65 |eparated| branche| |00001fc0| 73 3b 20 6e 65 69 74 68 | 65 72 0d 20 20 20 20 20 |s; neith|er. | |00001fd0| 20 20 20 20 20 64 6f 65 | 73 20 74 68 65 20 56 38 | doe|s the V8| |00001fe0| 20 72 65 67 65 78 70 28 | 33 29 2c 20 74 68 6f 75 | regexp(|3), thou| |00001ff0| 67 68 2e 0d 0d 20 20 20 | 20 20 20 20 20 20 20 44 |gh... | D| |00002000| 75 65 20 74 6f 20 65 6d | 70 68 61 73 69 73 20 6f |ue to em|phasis o| |00002010| 6e 20 63 6f 6d 70 61 63 | 74 6e 65 73 73 20 61 6e |n compac|tness an| |00002020| 64 20 73 69 6d 70 6c 69 | 63 69 74 79 2c 20 69 74 |d simpli|city, it| |00002030| 27 73 20 6e 6f 74 0d 20 | 20 20 20 20 20 20 20 20 |'s not. | | |00002040| 20 73 74 72 69 6b 69 6e | 67 6c 79 20 66 61 73 74 | strikin|gly fast| |00002050| 2e 20 20 49 74 20 64 6f | 65 73 20 67 69 76 65 20 |. It do|es give | |00002060| 73 70 65 63 69 61 6c 20 | 61 74 74 65 6e 74 69 6f |special |attentio| |00002070| 6e 20 74 6f 20 68 61 6e | 64 6c 69 6e 67 0d 20 20 |n to han|dling. | |00002080| 20 20 20 20 20 20 20 20 | 73 69 6d 70 6c 65 20 63 | |simple c| |00002090| 61 73 65 73 20 71 75 69 | 63 6b 6c 79 2e 0d 0d 0d |ases qui|ckly....| |000020a0| 0d 0d 0d 0d 0d 0d 0d 0d | 0d 0d 0d 0d 0d 0d 0d 0d |........|........| |000020b0| 0d 0d 0d 0d 0d 0d 0d 0d | 0d 0d 0d 0d 0d 0d 0d 0d |........|........| |000020c0| 0d 0d 0d 0d 0d 0d 0d 0d | 0d 0d 0d 0d 0d 0d 0d 20 |........|....... | |000020d0| 20 20 20 20 50 61 67 65 | 20 34 20 20 20 20 20 20 | Page| 4 | |000020e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |000020f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | | |00002100| 20 20 20 20 28 70 72 69 | 6e 74 65 64 20 34 2f 31 | (pri|nted 4/1| |00002110| 30 2f 39 31 29 0d 0d 0d | 0d 00 00 00 00 00 00 00 |0/91)...|........| |00002120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |00002180| 00 00 01 00 00 00 01 4c | 00 00 00 4c 00 00 00 32 |.......L|...L...2| |00002190| 3b 0d 65 78 74 65 72 6e | 20 63 68 61 72 09 09 09 |;.extern| char...| |000021a0| 2a 70 72 6f 6d 70 74 53 | 74 72 53 74 61 72 74 3b |*promptS|trStart;| |000021b0| 13 52 65 67 75 6c 61 72 | 20 45 78 70 72 65 73 73 |.Regular| Express| |000021c0| 69 6f 6e 73 02 00 00 00 | 54 45 58 54 41 4c 46 41 |ions....|TEXTALFA| |000021d0| 00 00 54 45 58 54 41 4c | 46 41 01 00 ff ff ff ff |..TEXTAL|FA......| |000021e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........| |000021f0| 00 00 a6 c5 21 7c 00 00 | 20 99 00 00 01 7e 20 75 |....!|..| ....~ u| |00002200| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 09 09 09 73 |nsigned |char...s| |00002210| 65 61 72 63 68 53 74 72 | 5b 5d 2c 20 72 65 70 6c |earchStr|[], repl| |00002220| 61 63 65 53 74 72 5b 5d | 3b 0d 65 78 74 65 72 6e |aceStr[]|;.extern| |00002230| 20 63 68 61 72 09 09 09 | 2a 72 65 70 6c 61 63 65 | char...|*replace| |00002240| 54 65 78 74 3b 0d 65 78 | 74 65 72 6e 20 69 6e 74 |Text;.ex|tern int| |00002250| 09 09 09 6c 61 73 74 57 | 61 73 59 61 6e 6b 3b 0d |...lastW|asYank;.| |00002260| 65 78 74 65 72 6e 20 69 | 6e 74 09 09 09 78 5f 70 |extern i|nt...x_p| |00002270| 72 65 66 69 78 5f 63 6f | 75 6e 74 3b 0d 65 78 74 |refix_co|unt;.ext| |00002280| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 94 00 00 |...H..Mo|naco....| |00002290| 00 00 00 00 00 00 00 00 | 00 6b 00 67 df d2 00 68 |........|.k.g...h| |000022a0| 33 aa 00 00 00 00 00 04 | 00 04 00 28 00 03 01 dd |3.......|...(....| |000022b0| 01 fd 00 28 00 03 01 dd | 01 fd 00 05 15 81 00 00 |...(....|........| |000022c0| 00 00 00 00 00 00 00 00 | 00 00 01 00 00 00 01 00 |........|........| |000022d0| 00 00 01 4c 00 00 00 4c | 00 00 00 32 00 58 e3 20 |...L...L|...2.X. | |000022e0| 06 9e 00 00 00 1c 00 32 | 00 00 4d 50 53 52 00 00 |.......2|..MPSR..| |000022f0| 00 0a 03 ed ff ff 00 00 | 00 00 00 59 7a 1c 00 00 |........|...Yz...| +--------+-------------------------+-------------------------+--------+--------+